<!--
 * @Author: your name
 * @Date: 2021-09-15 09:15:10
 * @LastEditTime: 2021-09-15 15:24:24
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \briup\6-jQuery\day04\1-canvas.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3-canvas</title>
    <script src="../js/jquery.js"></script>
</head>

<body>
    <div id="app">
        <canvas id="canvas" width="300" height="300"></canvas>
    </div>
</body>
<script>
    //找到dom节点
    var canvas = $("#canvas")[0];
    //检查浏览器是否支持canvas
    if (canvas.getContext) {
        //创建画笔 这里为2d图形
        //第一个圆
        var ctx = canvas.getContext("2d");
        ctx.lineWidth = 4;
        ctx.strokeStyle = "#1016ed";
        ctx.beginPath();
        ctx.arc(70, 70, 40, 0, 2 * Math.PI);
        ctx.stroke();
        //第二个圆
        ctx.strokeStyle = "#000000";
        ctx.beginPath();
        ctx.arc(160, 70, 40, 0, 2 * Math.PI);
        ctx.stroke();
        //第三个圆
        ctx.strokeStyle = "#f31113";
        ctx.beginPath();
        ctx.arc(250, 70, 40, 0, 2 * Math.PI);
        ctx.stroke();
        //第四个圆
        ctx.strokeStyle = "#eeaa17";
        ctx.beginPath();
        ctx.arc(115, 110, 40, 0, 2 * Math.PI);
        ctx.stroke();
        //第五个圆
        ctx.strokeStyle = "#5ddd37";
        ctx.beginPath();
        ctx.arc(203, 110, 40, 0, 2 * Math.PI);
        ctx.stroke();
    } else {
        alert("你的浏览器不支持canvas功能");
    }
</script>

</html>
</script>

</html>